package com.qeeyou.apps.android.craftsman.activity.me;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.qeeyou.apps.android.craftsman.R;
import com.qeeyou.apps.android.craftsman.view.CustomConfirmDialog;

public class WithdrawActivity extends Activity {

    private ImageView btnBack;
    private LinearLayout btnAccount;
    private EditText editMoney;
    private TextView txtvBalance;        //余额
    private Button btnWithdraw;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_withdraw);

        setView();

        setEvent();
    }

    private void setView() {
        btnBack = (ImageView) this.findViewById(R.id.btnBack4Withdraw);
        btnAccount = (LinearLayout) this.findViewById(R.id.btnAccount4Withdraw);
        editMoney = (EditText) this.findViewById(R.id.editMoney4Withdraw);
        txtvBalance = (TextView) this.findViewById(R.id.txtvBalance4Withdraw);
        btnWithdraw = (Button) this.findViewById(R.id.btnWithdraw4Withdraw);

    }

    private void setEvent() {
        btnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                WithdrawActivity.this.finish();
            }
        });

        btnWithdraw.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(WithdrawActivity.this, "提现事件", Toast.LENGTH_SHORT).show();

               final CustomConfirmDialog dialog =  new CustomConfirmDialog(WithdrawActivity.this);
               dialog.setCancelable(false);
               dialog.setMessage("提现申请提交成功!");
               dialog.setOnOKListener("知道了", new View.OnClickListener() {
                   @Override
                   public void onClick(View view) {
                       dialog.dismiss();
                       new Handler().postDelayed(new Runnable() {
                           @Override
                           public void run() {
                               WithdrawActivity.this.finish();
                           }
                       }, 2000);
                   }
               });
               dialog.show();

            }
        });
    }

}
